#!/usr/bin/ruby

READ_BUF_SIZE = 1024

$uri= "druby://localhost:8087"

module ThreadIO
	def puts(w=Thread.current[:player].w,str)
		w.puts(str)
	end

	def printf(w=Thread.current[:player].w,str)
		w.printf(str)
	end

	def gets(r=Thread.current[:r])
		r.gets
	end
end

case RUBY_PLATFORM
	when /mingw32/
		load File.dirname(__FILE__) + '/ct_win.rb'
	when /darwin/
		load File.dirname(__FILE__) + '/ct_mac.rb'
	when /linux/
		load File.dirname(__FILE__) + '/ct_mac.rb'
end

def err(e)
	puts "error : #{e.message}\n" << e.backtrace[0..3].join("\n")
end

def stdin_gets_async
	STDIN.read_nonblock 1024
rescue IO::EAGAINWaitReadable =>e
	nil
end

